<section class="content-header">
  <!-- <h1>
        意向客户
    </h1> -->
  <ol class="breadcrumb">
    <li><a ui-sref="dashboard"><i class="fa fa-dashboard"></i>我的面板</a></li>
    <li><a ui-sref="customer">正式客户</a></li>
    <li class="active" ng-bind="current_bread"></li>
  </ol>
</section>
<section class="content">
  <div class="detail-view-header-wrapper">
    <div class="box-footer detail-view-header" ui-scrollpoint ui-scrollpoint-enabled="true" ui-scrollpoint-class="fixed">
      <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
      <button type="button" class="btn btn-info" ng-click="save()">保存</button>
    </div>
  </div>
  <div class="box box-danger">
    <div class="box-header with-border">
      <h3 class="box-title">基本信息</h3>
      <div class="box-tools pull-right">
        <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
        </button>
      </div>
    </div>
    <form class="form-horizontal">
      <div class="box-body">
        <div class="form-group">
          <label class="col-sm-2 control-label">客户编号</label>
          <div class="col-sm-8">
            <input type="text" class="form-control" name="code" ng-model="data.code" disabled placeholder="系统自动生成">
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">客户名称<span class="required">*</span></label>
          <div class="col-sm-8">
            <input type="text" class="form-control" name="name" ng-model="data.name" data-rule="required; length[~100];">
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">行业类别</label>
          <div class="col-sm-8">
            <select ui-select2 class="form-control select2" name="industry" ng-model="data.industry" url="Dictionary/DroplistByGroup" paging="false" paramfield="group" paramvalue="行业类别"></select>
          </div>
          <div class="col-sm-2 add-dictionary">
            <!-- <a class="fa fa-plus" ui-sref=".dictionary({group: '行业类别'})" ui-sref-opts="{location:false}" title="新增行业类别"></a> -->
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">业务性质</label>
          <div class="col-sm-8">
            <select ui-select2 class="form-control select2" name="business_nature" ng-model="data.business_nature" url=" Dictionary/DroplistByGroup" paging="false" paramfield="group" paramvalue="业务性质"></select>
          </div>
          <div class="col-sm-2 add-dictionary">
            <!-- <a class="fa fa-plus" ui-sref=".dictionary({group: '业务性质'})" ui-sref-opts="{location:false}" title="新增业务性质"></a> -->
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">客户来源</label>
          <div class="col-sm-8">
            <select ui-select2 class="form-control select2" name="source" ng-model="data.source" ng-change="sourceChange()" url="Dictionary/DroplistByGroup" paging="false" paramfield="group" paramvalue="客户来源"></select>
          </div>
          <!-- <div class="col-sm-2 add-dictionary">
            <a class="fa fa-plus" ui-sref=".dictionary({group: '客户来源'})" ui-sref-opts="{location:false}" title="新增客户来源"></a>
          </div> -->
        </div>
        <div id="source_customer" class="form-group">
          <label class="col-sm-2 control-label">介绍人</label>
          <div class="col-sm-8">
            <select ui-select2 class="form-control select2" name="source_id" ng-view="source_name" ng-model="data.source_id" url="Customer/Introducers" paging="true" style="width: 100%;"></select>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">详细地址</label>
          <div class="col-sm-8">
            <select class="form-control" name="province" ng-model="province" ng-change="changeProvince()" ng-options="province.name for province in provinceList" style="width:18%">
              <option value="">请选择省份</option>
            </select>

            <select class="form-control" name="city" ng-model="city" ng-change="changeCity()" ng-options="city.name for city in province.cityList" style="width: 18%;">
              <option value="">请选择城市</option>
            </select>

            <select class="form-control" name="county" ng-model="county" ng-options="county for county in city.areaList" style="width: 18%;">
              <option value="">请选择县/区</option>
            </select>

            <input style="width:44%" type="text" class="form-control" placeholder="详细地址" ng-model="data.address" data-rule="length[~200];">
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">寄件地址</label>
          <div class="col-sm-8">
            <select style="width:18%" class="form-control" name="mailling_province" ng-model="mailling_province" mailling_province-change="changeMailProvince()" ng-options="province.name for province in mailProvinceList">
              <option value="">请选择省份</option>
            </select>

            <select style="width:18%" class="form-control" name="mailling_city" ng-model="mailling_city" ng-change="changeMailCity()" ng-options="city.name for city in mailling_province.cityList" style="width: 100%;">
              <option value="">请选择城市</option>
            </select>

            <select style="width:18%" class="form-control" name="mailling_county" ng-model="mailling_county" ng-options="county for county in mailling_city.areaList" style="width: 100%;">
              <option value="">请选择县/区</option>
            </select>

            <input style="width:44%" type="text" class="form-control" placeholder="详细地址" ng-model="data.mailling_address" data-rule="length[~200];">
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">传真</label>
          <div class="col-sm-8">
            <input type="text" class="form-control" name="fax" ng-model="data.fax" data-rule="length[~20];">
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">业务员</label>
          <div class="col-sm-8">
            <select ui-select2 class="form-control select2" id="salesmanSelect2" name="salesman_id" ng-view="salesman" ng-model="data.salesman_id" data-rule="required;" url="Member/List" paging="true" style="width: 100%;"></select>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">助理</label>
          <div class="col-sm-8">
            <select ui-select2 class="form-control select2" id="assistantSelect2" allowclear="true" name="assistant_id" ng-view="assistant_name" ng-model="data.assistant_id" url="Member/List" paging="true" style="width: 100%;"></select>
          </div>
        </div>
        <div class="form-group" ng-repeat="assistant in data.assistantList">
          <label class="col-sm-2 control-label" ng-bind="$index == 0 ? '助理' : ''"></label>
          <div class="col-sm-6">
            <select ui-select2 class="form-control select2" id="assistantSelect2{{$index}}" name="assistant[$index]" ng-model="assistant.id" url="Member/List" paging="true" style="width: 100%;"></select>
          </div>
          <div class="col-sm-2">
            <a href="javascript:;" style="display: inline-block; line-height: 30px;" ng-click="removeAssistat($index)">删除</a>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label"></label>
          <div class="col-sm-8">
            <a href="javascript:;" ng-click="addAssistat()">添加助理</a>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">备注</label>
          <div class="col-sm-8">
            <textarea class="form-control" rows="3" name="description" ng-model="data.description" data-rule="length[~100];"></textarea>
          </div>
        </div>
      </div>
    </form>
  </div>
  <div class="box box-danger" style="padding-bottom: 50px;">
    <div class="box-header with-border">
      <h3 class="box-title">联系人</h3>
      <div class="box-tools">
        <div class="box-tools pull-right">
          <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
          </button>
        </div>
      </div>
    </div>
    <div class="box-body table-responsive no-padding">
      <table class="table table-hover">
        <tbody>
          <tr>
            <th style="width: 10px">#</th>
            <th>联系人</th>
            <th>对接事务</th>
            <th>手机</th>
            <th>座机</th>
            <th>职务</th>
            <th>邮箱</th>
            <th>QQ</th>
            <th>微信</th>
            <th>备注</th>
            <th class="opt-col">操作</th>
          </tr>
          <tr ng-repeat="item in data.contactList">
            <td ng-bind="($index+1)+'.'"></td>
            <td ng-bind="item.name"></td>
            <td ng-bind="item.responsable"></td>
            <td ng-bind="item.mobile"></td>
            <td ng-bind="item.tel"></td>
            <td ng-bind="item.position"></td>
            <td ng-bind="item.email"></td>
            <td ng-bind="item.QQ"></td>
            <td ng-bind="item.wechat"></td>
            <td ng-bind="item.memo"></td>
            <td class="opt-col">
              <a href="javascript:;" class="fa fa-pencil orange" ng-click="editContact($index, item)" title="修改"></a>
              <a href="javascript:;" class="fa fa-trash-o red" ng-click="deleteContact($index, item)" title="删除"></a>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="box-footer clearfix">
      <button type="button" class="btn btn-info" ui-sref=".contact_add()" ui-sref-opts="{location:false}">新增</button>
    </div>
  </div>
</section>
<div ui-view="modal"></div>
<div ui-view="contact"></div>
